# -*- coding:utf-8 -*-
from . import InitConfig
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from flask_session import Session
session_obj = Session()


class Config(InitConfig):
    """线上运营配置文件"""
    DEBUG = False
    LOG_LEVEL = "INFO"

    INSTALLED_APPS = [
        "application.apps.home",
        "application.apps.users",
    ]

    SQLALCHEMY_DATABASE_URI = "mysql://root:123@127.0.0.1:3306/students?charset=utf8mb4"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_ECHO = False

    REDIS_HOST = "192.168.91.162"
    REDIS_PORT = 6379
    REDIS_DB = 0


    """session配置[SQLAlchemy]"""
    SESSION_TYPE = 'sqlalchemy'  # session类型为sqlalchemy
    SESSION_SQLALCHEMY = db      # SQLAlchemy对象
    SESSION_SQLALCHEMY_TABLE = 'session'  # session要保存的表名称
    SESSION_PERMANENT = True     # 如果设置为True，则关闭浏览器session就失效。
    SESSION_USE_SIGNER = False   # 是否对发送到浏览器上session的cookie值进行加密
    SESSION_KEY_PREFIX = 'session:'  # 保存到session中的值的前缀



